<?php

$api = app('Dingo\Api\Routing\Router');
$moduleName = 'Groupon';

// 平台后台api
$api->version('v1', ['prefix' => 'admin-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Admin\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'] ;

	$api->resource('groupons', "GrouponController", ['only' => $allMethod]);

	$api->resource('groupon-records', "GrouponRecordController", ['only' => $allMethod]);

	$api->get('groupon-record-stat/total', ['uses' => "GrouponRecordStatController@total"]);
});

// 租户api
// $api->version('v1', ['prefix' => 'tenant-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Tenant\V1'], function ($api) {
// 	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];
// });

// 普通用户api
$api->version('v1', ['namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Client\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];

	$api->post('/preview-groupon-orders', ['uses' => "PreviewGrouponOrderController@store"]);
	$api->post('groupon-orders', ['uses' => "GrouponOrderController@store"]);

	$api->resource('groupon-records', "GrouponRecordController", ['only' => $allMethod]);
});